<template>
	<view class="user">
		<view class="icon-box">
			<navigator open-type="navigateBack" class="icon">
				<text class="icon-fanhui iconfont icon-31fanhui1"></text>
			</navigator>
		</view>
		<personal-info :pages="pages" :userId="userId" :isfollow="isfollow" v-if="userId" @doFollow="handleFollow"></personal-info>
	</view>
</template>

<script>
	import PersonalInfo from '../../components/PersonalInfo.vue';

	export default {
		data() {
			return {
				pages: 'user',
			}
		},
		components: {
			PersonalInfo,
		},
		props: {
			userId: String,
			isfollow: String,
		},
		methods: {
			handleFollow(data) {
				// const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
				const eventChannel = this.getOpenerEventChannel();
				eventChannel.emit('acceptDataFromOpenedPage', {
					data,
				});
			}
		},
	}
</script>

<style lang="scss">
	.user {
		width: 100%;
		height: 100%;
		color: #FFFFFF;
		background-color: #000000;
		position: relative;

		.icon-box {
			position: absolute;
			top: 40px;
			padding: 0 20px;
			height: 45px;
			z-index: 99;

			.icon {
				width: 30px;
				height: 30px;
				border-radius: 50%;
				background-color: rgba(255, 255, 255, .2);
				text-align: center;
				position: relative;

				.icon-fanhui {
					position: absolute;
					top: 50%;
					left: 50%;
					transform: translate(-50%, -50%);
				}
			}
		}
	}
</style>
